const mongoose = require('mongoose')

const TaskAuditSchema = new mongoose.Schema({
    taskId: { //任务id
        type: mongoose.SchemaTypes.ObjectId,
        ref:'Task'
    },
    fileId:{ //文件id
        type: mongoose.SchemaTypes.ObjectId
    },
    taskname:{
        type:String
    },
    reviewer:{//审核人
        type: mongoose.SchemaTypes.ObjectId,
        ref:'User'
    },
    status: { //审核状态 0审核中  1已审核 2被打回
        type:Number,
        enum:[0,1,2],
        default:0
    },
    grade: { //任务等级的区分 5级
        type: Number,
        required:true
    },
    void:{ //是否可用  0是 1否
        type: Number,
        enum: [0, 1],
        required: true,
        default:0
    },
    process:{ //提交的进度
        type: Number,
    },
    isRead:{ //是否已读 true已读 false未读
        type:Boolean,
        default:false
    }
}, {
    // 创建时间和更新时间
    timestamps: true
})

module.exports = mongoose.model('TaskAudit', TaskAuditSchema, 'taskaudit')